import React, {Component} from 'react';

//onClick的传参 通过.bind(this,'')这种方式执行
export default class List extends Component {
  constructor (props) {
    super (props);
    console.log (props);
  }
  render () {
    return (
      <div>
        <div className="row">
          <div className="col-md-3 col-sm-3 col-xs-3">姓名</div>
          <div className="col-md-3 col-sm-3 col-xs-3">时间</div>
          <div className="col-md-6 col-sm-6 col-xs-6">金额</div>
        </div>
        {this.props.lists.map (list => {
          return (
            <div className="row" key={list.id}>
              <div className="col-md-3 col-sm-3 col-xs-3">
                {list.name}
              </div>
              <div className="col-md-3 col-sm-3 col-xs-3">{list.time}</div>
              <div className="col-md-3 col-sm-3 col-xs-3">{list.money}</div>
              <div className="col-md-3 col-sm-3 col-xs-3">
                <button
                  className="btn btn-primary"
                  onClick={this.props.handleClick.bind (this, list.name)}
                >
                  showMsg
                </button>
              </div>
            </div>
          );
        })}

      </div>
    );
  }
}
